﻿namespace SpaceInvaders
{
    using System;

    class Ship
    {
        public static int x;
        public static int y;
        public string shape;

        //constructor
        public Ship()
        {
            shape = "(|-+-|)";
            x = (Console.WindowWidth - 4) / 2;            // Places ship in middle. WIDTH == 110
            y = Console.WindowHeight - 1;
        }

        //displays the ship on screen
        public void DrawShip()
        {
            Console.SetCursorPosition(x, y);
            Console.ForegroundColor = ConsoleColor.DarkGreen;
            Console.Write(shape);
            Console.ResetColor();
        }

        public void ClearShip()
        {
            Console.SetCursorPosition(x, y);
            Console.Write(new string(' ', shape.Length));
        }

        //getter and setter methods
        public int GetX()
        {
            return x;
        }
        public int GetY()
        {
            return y;
        }
        public void SetX(int n)
        {
            x = n;
        }
        public int GetShipLength()
        {
            return shape.Length;
        }
        public string GetShape()
        {
            return shape;
        }
    }
}
